<?php
$title = "Título";
require_once 'header.php';
?>
<form id="dadosEquipa" action="http://localhost/Matematrix/equipa_inserir.php" method="post" enctype="multipart/form-data">
    <input type="hidden" name="id" value="<?php echo $idEquipa ?>" />
    <div>
        <div>
            <div id="divAvatar">
                <img  id="avatar" class="avatar" alt="avatar da equipa" src="<?php echo $avatar ?>" />
                <input id="avatarProc" class="avatar" type="file" accept="image/*" name="avatar" value="Escolher imagem" />
            </div>   
        </div>
        <div id="primeiraLinha">
            <label for="teamname" class="formLabelEsq">Username</label>
            <input class="formInput" id="teamname" name="login" readonly="readonly" type="text" value="<?php echo $nome; ?>"/>
            <label for="professor" class="formLabelDir">Professor</label>
            <input class="formInput" id="professor" name="professor" type="text" value="<?php echo $professor; ?>"/>
        </div>
        <div class="linha">
            <label class="formLabelEsq" for="nome" >Nome de Equipa</label>
            <input class="formInputLine" id="nomeEquipa" name="nome" type="text" value="<?php echo $nome; ?>"/>
        </div>
        <div class="linha">
            <label class="formLabelEsq" for="email" >E-mail</label>
            <input class="formInputLine" id="email" name="email" type="text" value="<?php echo $email; ?>"/>
        </div>
        <div class="linha">
            <label for="elementos" class="formLabelTextarea" >Elementos da equipa</label>
            <textarea class="formInputLine" name="elementos" rows="3" cols="30"><?php echo $elementos; ?></textarea>
        </div>
        <div class="linha">
            <label for="schoolname" class="formLabelEsq">Nome da Escola</label>
            <input class="formInput" id="schoolname" name="schoolname" type="text" value="<?php echo $escola; ?>"/>
            <label for="schoolphone" class="formLabelDir">Telefone</label>
            <input class="formInput" id="schoolphone" name="schoolphone" type="text" value="<?php echo $telefone; ?>"/>
        </div>
        <div class="linha">
            <label for="schooladdress" class="formLabelTextarea" id="regSchoolAddr">Morada completa</label>
            <textarea id="schooladdress" class="formInputLine" name="schooladdress" rows="3" cols="50"><?php echo $morada; ?></textarea>
        </div>
        <div class="linha">
            <label for="schoolcode" class="formLabelEsq">Código Postal</label>
            <input class="formInput" id="schoolcode" name="schoolcode" type="text" value="<?php echo $codpostal; ?>"/>
            <label class="formLabelDir">Localidade</label>
            <input class="formInput" id="schoolcity" name="schoolcity" type="text" value="<?php echo $localidade; ?>"/>
            <?php
                if (isset($_GET["valid"])) {
                    echo "<div class=\"linha erro\">";
                    echo "<p>*Alguns campos não foram preenchidos ou estão incorretos</p>";
                    echo "</div>";
                }
            ?>
        </div>
        <?php if (isset($email)) { ?>
            <div class="linha">
                <div id="linhaBotoes">
                    <input id="submeterEditarEquipa" type="submit" value="Guardar"/>                 
                    <input id="cancelarEditarEquipa" type="reset" id="cancelarEdicao"  value="Cancelar"/>
                    <form hidden="hidden" action="http://localhost/Matematrix/equipa_inserir.php"><input type="hidden" name="idEquipaRemover" value="<?php echo $idEquipa ?>"/>
                        <input id="botaoEditarEquipa" type="submit" id="editar" value="Remover"/>
                    </form>
                </div>
            </div>
        <?php } ?>
    </div>
</form>
<p><a href="http://localhost/Matematrix/desempenho.php?id=<?php echo $idEquipa ?>">Pontuação nas jornadas</a></p>
<?php
require_once 'footer.php';
?>
